package com.style_transfer.controller;

import com.style_transfer.model.Image;
import com.style_transfer.model.Location;
import com.style_transfer.service.impl.ImageServiceImpl;
import com.style_transfer.service.impl.LocationServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/location")
public class LocationController {
    @Autowired
    private LocationServiceImpl locationService;


    @ResponseBody
    @GetMapping("/getLocationByID/{l_id}")
    public Location getLocationByID(@PathVariable int l_id) {
        return locationService.getLocationByID(l_id);
    }

    @ResponseBody
    @GetMapping("/getLocationByName/{l_name}")
    public Location getLocationByName(String l_name) {
        return locationService.getLocationByName(l_name);
    }

    @ResponseBody
    @GetMapping("/getAllLocation")
    public List<Location> getAllLocation() {
        return locationService.getAllLocation();
    }

    @ResponseBody
    @GetMapping("/getAllLocationByParent")
    public List<Image> getAllLocationByParent(int parent) {
        return locationService.getAllLocationByParent(parent);
    }
}
